package com.sg.service.biz.app.nb;

import cn.hutool.core.bean.BeanUtil;
import com.sg.dto.biz.app.req.ImplementElevenReceivingFieldReqDto;
import com.sg.dto.biz.app.req.ObtainMaxOfCollectionsReqDto;
import com.sg.dto.biz.app.res.ImplementElevenReceivingFieldRespDto;
import com.sg.dto.biz.app.res.ObtainMaxOfCollectionsRespDto;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import java.util.Collections;

/**
 * @author ： 手工接入方法
 * @version 1.0
 * @since 2022/5/28 15:32
 */
@Service
public class NbUnstructuredData {
    /**
     * code:maxOfMultipleNumAddOne
     * name:M3-获取取数据集最大值（特殊方法）
     * desc:undefined
     * gen by moon at 8/29/2022, 1:04:49 AM
     **/
    @Trace(operationName = "M3-获取取数据集最大值（特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public ObtainMaxOfCollectionsRespDto obtainMaxOfCollections(ObtainMaxOfCollectionsReqDto reqDto) {
        ObtainMaxOfCollectionsRespDto retData = new ObtainMaxOfCollectionsRespDto();
        if (reqDto.getBusAppDocRelaList() == null || reqDto.getBusAppDocRelaList().size() == 0) {
            retData.setOrderNumber(1L);
            return retData;
        }
        retData.setOrderNumber(Collections.max(reqDto.getBusAppDocRelaList()) + 1);
        return retData;
    }

    /**
     * code:receptionService
     * name:M3接收入参业务字段
     * desc:undefined
     * gen by moon at 3/8/2023, 3:27:23 AM
     **/
    @Trace(operationName = "M3接收入参业务字段")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public ImplementAccessParameterBizFieldRespDto implementAccessParameterBizField(ImplementAccessParameterBizFieldReqDto reqDto) {
        return BeanUtil.toBean(reqDto, ImplementAccessParameterBizFieldRespDto.class);
    }

    /**
     * code:receptionService
     * name:M3-接收入参字段
     * desc:undefined
     * gen by moon at 6/9/2024, 4:35:56 PM
     **/
    @Trace(operationName = "M3-接收入参字段")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public ImplementElevenReceivingFieldRespDto implementElevenReceivingField(ImplementElevenReceivingFieldReqDto reqDto) {
        return BeanUtil.toBean(reqDto, ImplementElevenReceivingFieldRespDto.class);
    }
    //手工接入方法
}
